from selenium import webdriver


class GetDriver:
    # 定义一个 driver
    __Web_Driver = None

    @classmethod
    def get_web_driver(cls, url):
        if cls.__Web_Driver is None:
            cls.__Web_Driver = webdriver.Chrome()
            cls.__Web_Driver.maximize_window()
            cls.__Web_Driver.implicitly_wait(10)
            cls.__Web_Driver.get(url)
        return cls.__Web_Driver

    @classmethod
    def quit_web_driver(cls):
        if cls.__Web_Driver:
            cls.__Web_Driver.quit()
            cls.__Web_Driver = None
